package com.gxufl;

import com.gxufl.console.NoticeConsole;
import com.gxufl.console.TicketConsole;
import com.gxufl.util.BackException;
import com.gxufl.util.InputUtil;

public class Application {

	public static NoticeConsole noticeConsole = new NoticeConsole();
	public static TicketConsole ticketConsole = new TicketConsole();

	public static void main(String[] args) {
		// 显示主菜单
		fn显示主菜单();
	}

	public static void fn显示主菜单() {
		try {
			System.out.println("===主菜单-开始===");
			System.out.println("1、海报信息列表");
			System.out.println("2、售票录入");
			System.out.println("3、列出某电影及影厅售票数");
			System.out.println("4、删除海报");
			System.out.println("----");
			System.out.println("back:返回主菜单");
			System.out.println("quit:退出系统");
			System.out.println("===主菜单-结束===");

			String strSelectNum = InputUtil.nextInput("请选择菜单编号：");
			Integer selectNum = Integer.valueOf(strSelectNum);

			if (selectNum == 1) {
				fn显示海报信息列表及可操作菜单();
			} else if (selectNum == 2) {
				fn显示售票录入();
			} else if (selectNum == 3) {
				fn显示某电影及影厅售票数();
			}
		} catch (BackException e) {
			fn显示主菜单();
		}
	}

	public static void fn显示海报信息列表及可操作菜单() throws BackException {
		noticeConsole.searchNotice();
		System.out.println("===海报信息列表菜单-开始===");
		System.out.println("1、售票录入");
		System.out.println("----");
		System.out.println("back:返回主菜单");
		System.out.println("quit:退出系统");
		System.out.println("===海报信息列表菜单-结束===");

		int selectNum2 = InputUtil.nextIntInput("");
		if (selectNum2 == 1) {
			fn显示售票录入();
		}
	}

	public static void fn显示售票录入() throws BackException {
		ticketConsole.saveTicket();
	}

	public static void fn显示某电影及影厅售票数() throws BackException {
		ticketConsole.searchTicket();
	}

}
